﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class Clients_Control_Faq : System.Web.UI.UserControl
{
    private String strFaq = "<p class='Question'>$Question</p><p class='reply'>$Reply</p>";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack) {
            LoadQuetion();
            String strPage = "";
            try
            {
                strPage = Request.Params["Pro"].ToString().Trim();
            }
            catch
            {

            }
            lblContentTitle.Text = Constant.ContentTitle(strPage);
        }
    }

    private void LoadQuetion() {
        String strSql = "select p.idFaq,faqQuestion,faqReply from tbl_faq_lang faq,tbl_faq p "
            + " where faq.idFaq=p.idFaq and idlang=1 and isActive=1"+
            " order by orderId";
        DataTable tb = null;
        WebData db = new WebData();
        tb = db.tbl_Faqs.GetDataTableCache("faqQuetion", Constant.time, strSql, CommandType.Text);
        String url = "";
        foreach (DataRow row in tb.Rows) {
            String strQuetion = row["faqQuestion"].ToString().Trim();
            String strReply = row["faqReply"].ToString().Trim();
            url = url + strFaq.Replace("$Question", strQuetion).Replace("$Reply",strReply);
        }

        lblFaq.Text = url;
        tb.Dispose();
    }
}